import { Body, Controller, Post } from '@nestjs/common'
import { VersionService } from '@/service'
import { PageDto } from '@/controller/index.dto'
import { Auths } from '@/modules/guard'
import { BranchidDto, RepoidDto, SaveBranchDto, SaveRepoDto, VersionContextDto } from '@/controller/version/version.dto'

@Controller('version')
export class VersionControllers {
    constructor(private readonly versionService: VersionService) {}

    @Post('queryRepo')
    @Auths()
    public async queryRepo(@Body() data: PageDto) {
        return await this.versionService.queryRepo(data)
    }
    @Post('saveRepo')
    @Auths()
    public async saveRepo(@Body() data: SaveRepoDto) {
        return await this.versionService.saveRepo(data)
    }
    @Post('deleteRepo')
    @Auths()
    public async deleteRepo(@Body() data: RepoidDto) {
        return await this.versionService.deleteRepo(data)
    }

    @Post('queryBranch')
    @Auths()
    public async queryBranch(@Body() data: PageDto) {
        return await this.versionService.queryBranch(data)
    }
    @Post('saveBranch')
    @Auths()
    public async saveBranch(@Body() data: SaveBranchDto) {
        return await this.versionService.saveBranch(data)
    }
    @Post('deleteBranch')
    @Auths()
    public async deleteBranch(@Body() data: BranchidDto) {
        return await this.versionService.deleteBranch(data)
    }
    @Post('queryVersion')
    @Auths()
    public async queryVersion(@Body() data: any) {
        return await this.versionService.queryVersion(data)
    }
    @Post('setVersionContext')
    @Auths()
    public async setVersionContext(@Body() data: VersionContextDto) {
        return await this.versionService.setVersionContext(data)
    }
}
